package org.komarichin.jpa;

import org.springframework.orm.jpa.LocalEntityManagerFactoryBean;

import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceException;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 28.09.2009
 * Time: 11:00:24
 */
public class MyLocalEntityManagerFactoryBean extends
        LocalEntityManagerFactoryBean {
    private static EntityManagerFactory mInstance;

    @Override
    protected EntityManagerFactory createNativeEntityManagerFactory()
            throws PersistenceException {
        if (mInstance == null)
            mInstance = super.createNativeEntityManagerFactory();
        return mInstance;

    }

    public MyLocalEntityManagerFactoryBean() {
        super();
    }
}
